package com.esun.payment_api.mapper;

import com.esun.payment_api.bean.ApprovalNodeBean;
import com.esun.payment_api.bean.DkInvoiceBean;
import com.esun.payment_api.bean.InvFormBean;
import com.esun.payment_api.bean.InvProcessBean;
import com.esun.payment_api.domain.InvForm;
import com.esun.payment_api.domain.InvFormExample;
import java.util.List;

import com.esun.payment_api.domain.SysDictCustomer;
import com.esun.payment_api.dto.PInvCancelParam;
import com.esun.payment_api.dto.PInvCopyParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface InvFormMapper {
    long countByExample(InvFormExample example);

    int deleteByExample(InvFormExample example);

    int deleteByPrimaryKey(Short id);

    int insert(InvForm record);

    int insertSelective(InvForm record);

    List<InvForm> selectByExample(InvFormExample example);

    InvForm selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") InvForm record, @Param("example") InvFormExample example);

    int updateByExample(@Param("record") InvForm record, @Param("example") InvFormExample example);

    int updateByPrimaryKeySelective(InvForm record);

    int updateByPrimaryKey(InvForm record);

    int deleteById(Integer id);

    List<DkInvoiceBean> claimSelectInvoice(Short companyId, Integer claimId, Integer customerId, String searchStr);

    //插入一条数据并且返回主键id
    int insertSelectiveReturnId(InvForm record);

    List<SysDictCustomer> getInvCustomer(Integer invId);

    //存储过程
    void cancelPassedInv(@Param("param") PInvCancelParam param);

    //获取发票申请人
    List<InvProcessBean> getInvApplicant(@Param("uuid") String uuid);

    //获取发票流程
    List<InvProcessBean> getInvProcess(@Param("uuid") String uuid);

    //获取发票作废表uuid
    String getInvCancelUuid(@Param("uuid") String uuid);

    //发票提交审批
    void invSubmitApproval(Short coId, String uuid, Integer invId, Short userId, Short deptId, String flowTypeName);

    //发票申请被拒后重新提交审批
    void invResubmitApproval(Short coId, String uuid, Integer invId, Short userId, Short deptId, String flowTypeName);

    //发票申请流程审批 同意1 拒绝-1
    void invProcessApproval(Short status, Integer flowId, String flowNotes, Short userId, Integer invId);

    //作废发票申请流程审批 同意1 拒绝-1
    void cancelInvProcessApproval(Short status, Integer flowId, String flowNotes, Short userId, Integer invId);

    //校验发票提交申请
    String checkInvSubmit(@Param("id") Integer id);

    InvFormBean getById(Integer id);

    //获取发票-筛选-审批节点
    List<ApprovalNodeBean> getApprovalNodeList(Short coId);

    //发票复制
    void invCopy(@Param("param") PInvCopyParam param);

    //通过发票id，获取业务类型business_type
    String getBusinessTypeByInvId(Short coId, Integer invId);

    //判断当前用户是否有该发票的数据权限
    String checkInvDataAuth(Integer id, Short userId, Short deptId);
}